<template>
  <div class="container">
    <div class="loading">
      <img src="../../../static/images/ui.gif">
    </div>
  </div>
</template>

<script>
import { getSms, gettobind,getWxMpAuth } from "@/api";
export default {
  data() {
    return {
      loadingBol: false,
      ColorShow: true,
      sex: "1",
      count: 60,
      CodeShow: true,
      name: "",
      phone: "",
      timer: null,
      verifyCode: ""
    };
  },
  methods: {
    chooseSex(data) {
      if (data == 0) {
        this.ColorShow = true;
        this.sex = "1";
      } else if (data == 1) {
        this.ColorShow = false;
        this.sex = "2";
      }
    },
     //code 换token
    async getWxMpAuth(){
      let data = {
        code:this.$route.query.code,
        officialName: localStorage.officialName,
      }
      let res = await getWxMpAuth(data);
      if(res.success){
        localStorage.setItem("access-token",res.data.accessToken);
        localStorage.setItem("isBind",res.data.isBind)
        if(res.data.isBind){
          // console.log(localStorage.toPath);
          this.$router.push({path:localStorage.toPath})
        }else{
           this.$router.push({path:"/register",query:{flag:true}})
          // this.loadingBol = true;
        }
      }
    }
   
  },
  mounted(){
    this.getWxMpAuth();
  }
};
</script>

<style lang="scss" scoped>
.loading {
  img {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    margin: auto;
  }
}
.register {
  position: fixed;
  width: 100%;
  height: 100%;
  background: #fff;
  .header {
    width: 100%;
    height: 360px;
    float: left;
    .color {
      width: 275px;
      height: 275px;
      border-radius: 275px;
      margin: 20px auto;
      // float:left;
      background: rgba(255, 145, 64, 0.4);
      .color_item {
        width: 196px;
        height: 196px;
        border-radius: 196px;
        margin: 40px;
        float: left;
        background: rgba(255, 196, 70, 0.3);
        img {
          width: 136px;
          height: 136px;
          border-radius: 136px;
          border: 2px solid #fff;
          margin: 30px;
          float: left;
        }
      }
    }
  }
  .login_item {
    width: 90%;
    margin: 40px 5%;
    float: left;
    ul li {
      width: 100%;
      height: 100px;
      border-bottom: 1px solid #e1e1e1;
      float: left;
      .iconfont {
        font-size: 42px;
        float: left;
        line-height: 100px;
      }
      .list {
        color: #ffcd33;
      }
      .list1 {
        color: #ff5d66;
      }
      .list2 {
        color: #5785db;
      }
      input {
        width: 400px;
        height: 50px;
        margin: 30px 20px;
        font-size: 30px;
        border: none;
      }
      span {
        display: inline-block;
        width: 140px;
        margin: 20px 0;
        line-height: 60px;
        border-radius: 10px;
        text-align: center;

        border: solid 2px #cecece;
        color: #cecece;
      }
      .active {
        color: #ff5d66;
        border: 1px solid #ff5d66;
      }
      .item_ {
        margin: 20px 30px;
      }
      .code {
        float: right;
      }
    }
    .footer {
      width: 100%;
      margin: 80px 0 0 0;
      line-height: 90px;
      background: #ffca14;
      border-radius: 10px;
      text-align: center;
      float: left;
      font-size: 36px;
      color: #000;
    }
  }
}
</style>
